$(function(){

});


function uploadFile(){
	var files=document.getElementById("contract").files;
	var fileStr="";
	for(var i=0;i<files.length;i++){
		fileStr+=files[i].name+'|';
	}
	$('#file-name').html(fileStr);
}

function contractAdd() {
	if (!Validator.Validate(document.getElementById("form1"), 1)) {
		return;
	}
	//表单渲染
	$('#form1').submit(function() {
		var options = {
			url : ctp + "/contractController/contractSave.shtml",
			type : 'POST',
			success : function(result) {
				if(result=='1') {  
					jalert9("保存成功！");
					setTimeout(function(){
						parent.searchData();
						back();
					},WARN_TIME_OUT);
				}else if(result=='0') {     
					jalert("保存失败，请联系管理员！");   
				}
			}
		};
		$('#form1').ajaxSubmit(options);
		return false;
	});

	$('#form1').submit();
}

function selectWorker(){
	layui.layer.open({
		type: 2,
		area: ['1000px', '450px'],
		title: "选择工人",
		fixed: false,
		maxmin: false,
		content: ctp + "/contractController/selectWorkerPage.shtml"
	});
}

function addWorker(workerId,workerName,jobno){
	$('#name').val(workerName);
	$('#jobno').val(jobno);
	$('#owner').val(workerId);
}


function back(){
	window.parent.closeDialogWin();
}

